﻿using System;
using System.Windows.Controls;

namespace DrCarDrive.Util
{
    public class TextValidator:ValidationRule
    {

        public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
        {
            int odometer;
            if (Int32.TryParse(value.ToString(), out odometer))
            {
                if (odometer >= 0)
                {
                    return new ValidationResult(true, null);
                }
            }
            return new ValidationResult(false, "Please enter odometer value");
        }

    }
}
